package com.guiguli.StringJoiner;

import java.util.StringJoiner;

public class StrinJoinerDemo2 {
    public static void main(String[] args) {
        //1.创建对象    设置间隔符号 开始符 结束符号
        StringJoiner sj = new StringJoiner(",","[","]");

        //2.添加元素
        sj.add("aaa").add("bbb").add("ccc");

        var len = sj.length();
        System.out.println(len);

        var str = sj.toString();
        System.out.println(str);

        //3.打印
        System.out.println(sj);
    }
}
